Ext.define("AM.view.UserList",{
	extend:'Ext.grid.Panel',
	alias:'widget.userlist',
	title:'laoluo grid',
	columns:[
		{xtype:'rownumberer'},//自增序号
		{test:'id',dataIndex:'id',hidden:true},
		{text:'name',dataIndex:'name',width:100},
		{text:'age',dataIndex:'age',width:100},
		{text:'email',dataIndex:'email',width:150,editor:{
			xtype: 'textfield',
            allowBlank: false
		}},
		{text:'money',dataIndex:'money',xtype:'numbercolumn',format:'0,000.00',width:80}, //Number列，"0.00","0,000"
		{text:'birthday',dataIndex:'birthday',xtype:'datecolumn',format:'Y-m-d G:i',width:200}, //Date列
		{text:'描述',xtype:'templatecolumn',tpl:'姓名:{name} 年龄:{age}',width:200}, //模板列，{name}、{age}引用数据
		{text:'性别',dataIndex:'sex',width:50,renderer:function(value){ //readerer修改数据
			if(value){
				if(value=="女"){
					return "<font color=red>女</font>";
				}else{
					return value;
				}
			}
		}},
		{text:'IT',xtype:'booleancolumn',dataIndex:'isIT',trueText:'是',falseText:'否',width:50}//boolean列，trueText，falseT
	],
	store : 'UserStore',
	initComponent:function(){
		this.callParent(arguments);
	},
	tbar: [
		{ xtype: 'button',id:'new',text: '新建',iconCls:'icon-add'},
		{ xtype: 'button',id:'update',text: '修改',iconCls:'icon-edit'},
		{ xtype: 'button',id:'delete',text: '删除',iconCls:'icon-remove'},
		"->",
		{ xtype:'textfield',id:'keyWordHidden',fieldLabel:'分页记录',hidden:true},
		{ xtype:'textfield',id:'keyWord',fieldLabel:'关键字',labelWidth:50,width:200,emptyText:'输入用户信息',selectOnFocus:true},
		{ xtype: 'button',id:'search',text: '查找',iconCls:'icon-search'}
	],
	dockedItems :[{
			xtype:'pagingtoolbar',
			id:'pt',
			store:'UserStore',
			dock:'bottom',
			displayInfo:true
	}],
	selType:'checkboxmodel',//设定选择模式
	//selType: 'cellmodel',
    plugins: [
        Ext.create('Ext.grid.plugin.CellEditing', {
            clicksToEdit:2
        })
    ],
	multiSelect:true//运行多选
});